<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LIST TEACHER</title>
</head>
<link rel="stylesheet" type="text/css" href="/easyui/1.3.4/themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="/css/wu.css" />
<link rel="stylesheet" type="text/css" href="/css/icon.css" />
<script type="text/javascript" src="/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="/easyui/1.3.4/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/easyui/1.3.4/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="/js/jquery-form.js"></script>
<body>
	<c:if test="${activeUser.tid != -1 }">
		<table class="easyui-datagrid" style="width:700px;height:250px" id="dg_dishes_info2"
			data-options="fitColumns:true,border:false,fit:true,rownumbers:true,singleSelect:true,url:'<%=request.getContextPath()%>/addController/listTeacher',method:'get',toolbar:toolbar,pagination:true">
		<thead>
			<tr>
				<th data-options="field:'username',width:20">教师名称</th>
				<th data-options="field:'type_',width:20">教师类型</th>
				<!-- <th data-options="field:'remarks',width:20">备注</th> -->

			</tr>
		</thead>
	</table>
	</c:if>
	<c:if test="${activeUser.tid == -1 }">
		<table class="easyui-datagrid" style="width:700px;height:250px" id="dg_dishes_info2"
			data-options="fitColumns:true,border:false,fit:true,rownumbers:true,singleSelect:true,url:'<%=request.getContextPath()%>/addController/listTeacher',method:'get',pagination:true">
		<thead>
			<tr>
				<th data-options="field:'username',width:20">教师名称</th>
				<th data-options="field:'type_',width:20">教师类型</th>
				<!-- <th data-options="field:'remarks',width:20">备注</th> -->

			</tr>
		</thead>
	</table>
	</c:if>
	<script type="text/javascript">
		var toolbar = [{
			text:'添加教师',
			iconCls:'icon-add',
			handler:function(){
				$('#ff_dishes_info_add').form("clear");
				$("#dlg_dishes_info_add2").dialog("open");
			}
		
		}];
	</script>
	<div id="dlg_dishes_info_add2" class="easyui-dialog" title="TEACHER" data-options="closed:true,iconCls:'icon-save'" style="width:300px;height:200px;padding:10px">
		<form id="ff_dishes_info_add"  method="post" >
	    	<table cellpadding="5">
	    		
	    		<tr>
	    			<td>教师名称:</td>
	    			<td><input type="text" class="easyui-textbox" name="username" id="username"></input></td>
	    		</tr>
	    		
	    		<tr>
	    			<td>教师类型:</td>
	    			<td>
	    			<select name="type" id="type">
	    				<option value="1">讲师</option>
	    				<option value="2">班主任</option>
	    				<option value="3">主任</option>
	    			</select>
	    			</td>
	    		</tr>
	    		
	    		<tr>
	    			<td>教师备注:</td>
	    			<td><input type="text" class="easyui-textbox" name="remarks"   id="remarks"></input></td>
	    		</tr>
	    		<!-- <tr>
	    			<td>账户密码:</td>
	    			<td><input type="text" class="easyui-textbox" name="password"  ></input></td>
	    		</tr> -->
	    		
	    	</table>
	    </form>
	    <div style="text-align:center;padding:5px">
	    	<a href="javascript:void(0)" class="easyui-linkbutton" onclick="submit_dishes_info_add()">提交</a>
	    	<a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()">清空</a>
	    </div>
	</div>
	<script type="text/javascript">
	function clearForm(){
		$("#ff_dishes_info_add").form("clear");
		
	}
		function submit_dishes_info_add(){
			$("#ff_dishes_info_add").form('submit',{
				url:"<%=request.getContextPath()%>/addController/doAddTeacher",
				success:function (data){
					if(data){
						$.messager.show({
							title:'温馨提示',
							msg:'恭喜您！添加成功！',
							timeout:3000,
							showType:'slide'
						});
						$("#dlg_dishes_info_add2").dialog("close");
						$("#dg_dishes_info2").datagrid("reload");
					}else{
						$.messager.show({
							title:'温馨提示',
							msg:'添加失败',
							timeout:3000,
							showType:'slide'
						});
					}
				}
			})
		}
			/* $("#ff_dishes_info_add").ajaxSubmit({ */
				<%-- $.post(
				type:"post",
				url:"<%=request.getContextPath()%>/addController/doAddTeacher?username="+username+"&type="+type+"&remarks="+remarks,
				dataType:"json",
			    success: function(flag){
			     	if(flag){
						$.messager.show({
							title:'温馨提示',
							msg:'恭喜您！添加成功！',
							timeout:3000,
							showType:'slide'
						});
						$("#dlg_dishes_info_add2").dialog("close");
						$("#dg_dishes_info2").datagrid("reload");
					}else{
						$.messager.show({
							title:'温馨提示',
							msg:'对不起！添加失败！',
							timeout:3000,
							showType:'slide'
						});
					  $("#dg_dishes_info2").datagrid("reload");
					}
				})
			/* });  */
		} --%>
	</script>
	
</body>
</html>